import request from '@/utils/request'
import { buildQueryParams } from '@/utils/common'

// 自营店申请
export function shopApply(data) {
    return request({
        url: '/store/audit',
        method: 'POST',
        data
    })
}

// 角色信息
export function getAllRoles(data) {
    return request({
        url: '/store/info/role/all?type='+data,
        method: 'GET'
    })
}

// 查询所有店铺
export function getAllStores() {
    return request({
        url: '/store/info/store/list',
        method: 'GET'
    })
}

// 店铺规则列表
export function getSetStores({ storeName, pageNum, pageSize }) {
    let url = `/store/store/set/list?pageNum=${pageNum}&pageSize=${pageSize}`
    if(storeName) {
        url = `/store/store/set/list?storeName=${storeName}&pageNum=${pageNum}&pageSize=${pageSize}`
    }
    return request({
        url,
        method: 'GET'
    })
}

// 获取店铺设置详细信息
export function getStoreSetDetails(data) {
    return request({
        url: '/store/store/set/'+data,
        method: 'GET'
    })
}

// 更新店铺设置
export function updateStoreSet(data) {
    return request({
        url: '/store/store/set',
        method: 'POST',
        data
    })
}

// 店铺设置条形码列表
export function getBarcodeList(data) {
    return request({
        url: '/store/store/set/bar/code?storeId='+data,
        method: 'GET'
    })
}

// 获取店铺衣物条形码设置详细信息
export function getClothBarcodeInfo(data) {
    return request({
        url: '/store/store/set/clothes/'+data,
        method: 'GET'
    })
}

// 更新店铺衣物条形码设置
export function updateClothBarcodeInfo(data) {
    return request({
        url: '/store/store/set/clothes',
        method: 'POST',
        data
    })
}

// 获取店铺工厂包单条形码设置详细信息
export function getFactoryBarcodeInfo(data) {
    return request({
        url: '/store/store/set/factory/'+data,
        method: 'GET'
    })
}

// 更新店铺工厂包单条形码设置
export function updateFactoryBarcodeInfo(data) {
    return request({
        url: '/store/store/set/factory',
        method: 'POST',
        data
    })
}

// 获取店铺免邮列表
export function getStoreFreeShippingList(data) {
    return request({
        url: '/store/store/set/ship/list/'+data,
        method: 'GET'
    })
}

// 获取店铺免邮设置详细信息
export function getStoreFreeShipSetInfo({ storeId, shipType }) {
    return request({
        url: `/store/store/set/ship/${storeId}/${shipType}`,
        method: 'GET'
    })
}

// 更新邮费设置
export function updateStoreFreeShip(data) {
    return request({
        url: '/store/store/set/ship',
        method: 'POST',
        data
    })
}

// 获取店铺不清洗城市设置详细信息
export function getStoreUnwashCityInfo(data) {
    return request({
        url: '/store/store/set/city/'+data,
        method: 'GET'
    })
}

// 更新店铺不清洗城市设置
export function updateStoreUnwashCity(data) {
    return request({
        url: '/store/store/set/city',
        method: 'POST',
        data
    })
}

// 获取店铺优惠券设置列表
export function getStoreCouponSetList({ storeId, pageSize, pageNum, display }) {
    let url = `/store/store/set/coupon/${storeId}?pageSize=${pageSize}&pageNum=${pageNum}`
    if(display) {
        url = `/store/store/set/coupon/${storeId}?pageSize=${pageSize}&pageNum=${pageNum}&display=`+display
    }
    return request({ url, method: 'GET' })
}

// 更新店铺优惠券设置
export function updateStoreCouponSet(data) {
    return request({
        url: '/store/store/set/coupon',
        method: 'POST',
        data
    })
}

// 获取店铺优惠券设置详细信息
export function getStoreConponSetInfo(data) {
    return request({
        url: '/store/store/set/coupon/info/'+data,
        method: 'GET'
    })
}

// 删除店铺优惠券
export function deleteStoreConpon(data) {
    return request({
        url: '/store/store/set/coupon/'+data,
        method: 'DELETE'
    })
}

// 获取店铺设置轮播图列表
export function getStoreBannerSetList({ storeId, pageSize, pageNum }) {
    return request({
        url: `/store/store/set/banner/list/${storeId}?pageSize=${pageSize}&pageNum=${pageNum}`,
        method: 'GET'
    })
}

// 更新店铺轮播图设置
export function updateStoreBannerSet(data) {
    return request({
        url: '/store/store/set/banner',
        method: 'POST',
        data
    })
}

// 获取店铺设置轮播图详细信息
export function getStoreBannerSetInfo(data) {
    return request({
        url: '/store/store/set/banner/'+data,
        method: 'GET'
    })
}

// 删除店铺设置轮播图
export function deleteStoreBanner(data) {
    return request({
        url: '/store/store/set/banner/'+data,
        method: 'DELETE'
    })
}

// 获取店铺保价设置列表
export function getStoreProtectPriceSetList({ storeId, pageNum, pageSize }) {
    return request({
        url: `/store/store/set/insured/list/${storeId}?pageSize=${pageSize}&pageNum=${pageNum}`,
        method: 'GET'
    })
}

// 更新店铺保价设置
export function updateStoreProtectPriceSet(data) {
    return request({
        url: '/store/store/set/insured',
        method: 'POST',
        data
    })
}

// 删除店铺保价设置
export function deleteStoreProtectPriceSet(data) {
    return request({
        url: '/store/store/set/insured/'+data,
        method: 'DELETE'
    })
}

// 更新店铺邮费收费规则设置
export function updateStorePostageChargesSet(data) {
    return request({
        url: '/store/store/set/postage/charges',
        method: 'POST',
        data
    })
}

// 获取店铺邮费收费详细信息
export function getStorePostageChargesSetInfo(data) {
    return request({
        url: '/store/store/set/postage/charges/list/'+data,
        method: 'GET'
    })
}

// 获取店铺加急时间设置列表
export function getStoreUrgentSetList({ storeId, keyword }) {
    return request({
        url: `/store/store/set/urgent/${storeId}?keyword=${keyword}`,
        method: 'GET'
    })
}

// 衣物设置一级分类列表
export function getStoreClothesCateList(data) {
    return request({
        url: '/store/wash/category/list?storeId='+data,
        method: 'GET'
    })
}

// 衣物设置商品新增、修改一级分类
export function updateStoreClothesCategory(data) {
    return request({
        url: '/store/wash/category',
        method: 'POST',
        data
    })
}

// 衣物设置二级分类列表
export function getStoreClothesTypesList(data) {
    const queryString = buildQueryParams(data)
    return request({
        url: '/store/wash/goods/list?'+queryString,
        method: 'GET'
    })
}

// 衣物设置商品新增、修改二级分类
export function updateStoreClothesSubcategory(data) {
    return request({
        url: '/store/wash/goods',
        method: 'POST',
        data
    })
}

// 更新加急时间设置
export function updateStoreUrgentSet(data) {
    return request({
        url: '/store/store/set/urgent',
        method: 'POST',
        data
    })
}

// 删除店铺加急时间设置
export function deleteStoreUrgentSet(data) {
    return request({
        url: '/store/store/set/urgent/'+data,
        method: 'DELETE'
    })
}

// 店铺管理自营店列表
export function getStoreList(data) {
    return request({
        url: '/store/equipment/store/list',
        method: 'POST',
        data
    })
}

// 物业管理列表
export function getPropertyShopList(data) {
    return request({
        url: '/store/equipment/property/store/list',
        method: 'POST',
        data
    })
}

// 设备管理列表
export function getStoreEquipmentList(data) {
    return request({
        url: '/store/equipment/list',
        method: 'POST',
        data
    })
}

// 未绑定店铺的设备列表
export function getStoreUnbindEquipmentList(data) {
    return request({
        url: '/store/equipment/unbind/list',
        method: 'POST',
        data
    })
}

// 修改设备激活状态
export function updateDeviceActivationStatus(data) {
    return request({
        url: '/store/equipment/set/activation',
        method: 'POST',
        data
    })
}

// 删除设备
export function removeStoreDevice(data) {
    return request({
        url: '/store/equipment/delete',
        method: 'POST',
        data
    })
}

// 获取设备信息
export function getDeviceInfo(data) {
    return request({
        url: '/store/equipment/'+data,
        method: 'GET'
    })
}

// 绑定设备店铺列表
export function getBindDeviceShopInfo() {
    return request({
        url: '/store/equipment/info',
        method: 'GET'
    })
}

// 绑定设备
export function bindDevice(data) {
    return request({
        url: '/store/equipment/bind',
        method: 'POST',
        data
    })
}

// 衣柜管理列表
export function getWardrobeSetList(data) {
    return request({
        url: '/store/equipment/wardrobe/set',
        method: 'POST',
        data
    })
}

// 修改柜子使用状态
export function updateEquipmentWardrobeUseStatus(data) {
    return request({
        url: '/store/equipment/set/use/type',
        method: 'POST',
        data
    })
}

// 商品设置颜色设置列表
export function getColourSettingsList(data) {
    return request({
        url: '/store/wash/color/list?storeId='+data,
        method: 'GET'
    })
}

// 新增、修改商品设置颜色设置
export function updateStoreColourSetup(data) {
    return request({
        url: '/store/wash/color',
        method: 'POST',
        data
    })
}

// 商品设置瑕疵设置列表
export function getDefectSettingsList(data) {
    return request({
        url: '/store/wash/flaw/list?storeId='+data,
        method: 'GET'
    })
}

// 新增、修改商品设置瑕疵设置
export function updateStoreDefectSetup(data) {
    return request({
        url: '/store/wash/flaw',
        method: 'POST',
        data
    })
}

// 首页banner图片
export function getBannerList() {
    return request({
        url: '/store/index/banner',
        method: 'GET'
    })
}

// 查询个人所有店铺
export function getShopList() {
    return request({
        url: '/store/index/selectStore',
        method: 'GET'
    })
}

// 首页数据
export function getHomePageInfo(data) {
    return request({
        url: '/store/index',
        method: 'POST',
        data
    })
}

// 获取资讯轮播列表
export function getNewsList() {
    return request({
        url: '/store/index/information/list',
        method: 'GET'
    })
}

// 查询店铺用户列表
export function getStoreUserList(data) {
    return request({
        url: '/store/user/list',
        method: 'POST',
        data
    })
}

// 团体管理列表
export function getGroupManagementList(data) {
    return request({
        url: '/store/group/mar/list',
        method: 'POST',
        data
    })
}

// 团体卡审核列表
export function getGroupCardAuditList(data) {
    return request({
        url: '/store/audit/list/group',
        method: 'POST',
        data
    })
}

// 团体卡审核
export function submitGroupCardAudit(data) {
    return request({
        url: '/store/audit/group/card',
        method: 'POST',
        data
    })
}

// 团体卡消费明细
export function getGroupCardConsumptionDetails(data) {
    return request({
        url: '/store/group/mar/consume/list',
        method: 'POST',
        data
    })
}

// 查询店铺收衣订单列表
export function getReceiveClothesList(data) {
    return request({
        url: '/store/order/storeCollOrder/list',
        method: 'POST',
        data
    })
}

// 物流订单所有配送方式
export function getAllDeliveryMethods() {
    return request({
        url: '/store/order/delivery/collection',
        method: 'POST'
    })
}

// 复核订单列表
export function getOrderReviewList(data) {
    return request({
        url: '/store/order/storeAuditOrder/list',
        method: 'POST',
        data
    })
}